package cn.hongwei.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author Great
 * @email 1224028994@qq.com
 * 首页弹窗的实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("index_popup")
public class IndexPopup {
    //id
    @TableId
    @TableField("id")
    private Long id;
    //弹窗标题
    @TableField("popup_title")
    private String popupTitle;
    //弹窗编号，用uuid生成
    @TableField("popup_no")
    private String popupNo;
    //弹窗次数
    @TableField("show_count")
    private Integer showCount;
    //到期时间
    @TableField("expire_time")
    @JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss",timezone="Asia/Shanghai")
    private Date expireTime;
    //状态，0删除，1存在。
    @TableLogic
    @TableField("status")
    private Integer status;

    @Override
    public boolean equals(Object obj){
        IndexPopup popup=(IndexPopup)obj;
        return this.getPopupNo().equals(popup.getPopupNo());
    }
}
